CC =		gcc
CFLAGS =	-Wall
LDFLAGS =	
PREFIX =	/usr/local

all:	bhw bhw2 label inst

bhw:
	${CC} ${CFLAGS} -c -o bhw.o bhw.S
	ld -N -Ttext 0x0 --oformat binary -s -o bhw bhw.o
	./sign.pl bhw

bhw2:
	${CC} ${CFLAGS} -c -o bhw2.o bhw2.S
	ld -N -Ttext 0x0 --oformat binary -s -o bhw2 bhw2.o
	./sign.pl bhw2

label:
	${CC} ${CFLAGS} -o label label.c

inst:
	${CC} ${CFLAGS} -o inst inst.c

clean:
	rm *.o inst label bhw bhw2

install:
	cp bhw /boot/bhw
	cp bhw2 /boot/bhw2
	mkdir ${PREFIX}/share/bootka
	cp inst ${PREFIX}/share/bootka
	cp label ${PREFIX}/share/bootka
	cp bootka-install ${PREFIX}/bin
